package lean;
import java.util.Arrays;
public class one {
    public static void main(String[]args){
        //定义二维数组
        int num[][]= {{1,2,3},{4,5,6},{7,8,9}};
        int num1[][]={{1,7,4},{2,5,6},{3,6,9}};
        //数组排序（升序）
        Arrays.sort(num1[0]);
        System.out.println("升序的结果是:"+Arrays.toString(num1[0]));
        //数组中的元素全部赋值为6h
 Arrays.fill(num[1],6);
 System.out.println("全部赋值为6:"+Arrays.toString(num[1]));
 //比较两个数组是否相等
        System.out.println("比较两个数组是否相等:"+Arrays.equals(num[0],num1[0]));
        //数组转换成一个字符串类型
        System.out.println("转换成:"+Arrays.toString(num[2]));
        //把数组num[1]复制成一个长度为length的新数组，返回类型与复制的数组一致
        int suzu[]=Arrays.copyOf(num[1],6);
        for(int i=0;i<suzu.length;i++){
            System.out.print(suzu[i]+" "+"\t");
            //查询元素值的在数组中的下标
            //int two=Arrays.binarySearch(num[1],4);
        }
        int two=Arrays.binarySearch(num1[0],4);
        System.out.print(two+"\t");
    }
}
